<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp"%>
<div id="printDiv" class="well form-inline">
	<input type="hidden" name="id" value="${order.id}" />
	<table class="table table-striped table-bordered table-condensed">
		<thead>
			<i class="icon-flag"></i>
			<strong>订单详情</strong>
		</thead>
		<tr>
			<td class="span2">订单编号:</td>
			<td>
				<span class="tBlue">${order.code}</span>
			</td>
		</tr>
		<tr class="hide">
			<td class="span2">订单名称:</td>
			<td>${order.name}</td>
		</tr>
		<tr>
			<td>发货部门:</td>
			<td>
				<span class="tBlue">${order.departmentTarget.name}</span>
			</td>
		</tr>
		<tr id="mDetail">
			<td>商品定购详情：</td>
			<td>
				<div id="mInfo"></div>
			</td>
		</tr>
		<tr>
			<td>订购数量:</td>
			<td>
				<span class="tRed">
					<fmt:formatNumber value="${order.boxNumber}" pattern="###,##0.00"></fmt:formatNumber>
				</span>
				(件)
			</td>
		</tr>
		<tr>
			<td class="tRed">订单总价:</td>
			<td>
				<span class="tRed">
					<fmt:formatNumber pattern="###,###.##" value="${order.totalCost}"></fmt:formatNumber>
				</span>
				(元)
			</td>
		</tr>
		<tr>
			<td>下单时间:</td>
			<td>
				<span class="tBlue">
					<fmt:formatDate value="${order.orderCreateTime}" pattern="yyyy-MM-dd HH:mm:ss" />
				</span>
			</td>
		</tr>
		<c:if test="${order.logsMap != null}">
			<tr>
				<td valign="top">订单状态:</td>
				<td>
					<table class="table table-striped table-bordered table-condensed">
						<tr class="tBlue">
							<th>#</th>
							<th>时间</th>
							<th>订单状态</th>
							<th>部门</th>
							<th>操作员</th>
							<th>操作内容</th>
						</tr>
						<c:forEach items="${order.logsMap }" varStatus="i" var="entry">
							<tr>
								<c:set value="${entry.value }" var="ob">
								</c:set>
								<td>${i.index + 1}</td>
								<td>${ob['date']}</td>
								<td>${ob["status"] }</td>
								<td>${ob["department"]}</td>
								<td>${ob["user"] }</td>
								<td>${ob["msg"] }</td>
							</tr>
						</c:forEach>
					</table>
				</td>
			</tr>
		</c:if>
		<tr>
			<td>收货部门:</td>
			<td>
				<span class="tBlue">${order.department.name}</span>
			</td>
		</tr>
		<tr>
			<td>联系人:</td>
			<td>${order.createUser}</td>
		</tr>
		<tr>
			<td>联系电话:</td>
			<td>${order.phone}</td>
		</tr>
		<tr>
			<td>订单备注:</td>
			<td>${order.memo}</td>
		</tr>
		<tr>
			<td>订单受理人:</td>
			<td>
				<span>${order.orderChargeUser}</span>
			</td>
		</tr>
		<tr>
			<td>受理时间:</td>
			<td>
				<span class="tBlue">
					<fmt:formatDate value="${order.receivedTime}" pattern="yyyy-MM-dd HH:mm:ss" />
				</span>
			</td>
		</tr>
		<tr>
			<td>订单处理备注:</td>
			<td>${order.memo2}</td>
		</tr>
		<tr>
			<td>出库时间:</td>
			<td>
				<fmt:formatDate value="${order.outTime}" pattern="yyyy-MM-dd HH:mm:ss" />
			</td>
		</tr>
		<tr>
			<td>出库操作员:</td>
			<td>${order.outUser}</td>
		</tr>
		<tr>
			<td>出库备注:</td>
			<td>${order.memo3}</td>
		</tr>
		<c:if test="${order.memo4 != null }">
			<tr>
				<td>收货人:</td>
				<td>${order.receivedUser}</td>
			</tr>
			<tr>
				<td>收货时间:</td>
				<td>${order.receivedDate}</td>
			</tr>
			<tr>
				<td>收货备注:</td>
				<td>${order.memo4}</td>
			</tr>
		</c:if>
	</table>
</div>
<table class="table table-striped table-bordered table-condensed">
	<tr>
		<td align="center">
			<input class="btn span btn-primary" id="printBtn" type="button" value="打印订单" />
			&nbsp;
			<input class="btn span1 btn-info" type="button" value="返 回" back="back" />
		</td>
	</tr>
</table>
<script src="${ctx}/resources/js/jquery.PrintArea.js" type="text/javascript"></script>
<script>
	$(function() {
		$("#printBtn").click(function() {
			$("#printDiv").printArea();
		});
		$("#mInfo").load("${ctx}/adoms/orderLine/list/${order.id} #dataList", function() {
			$("#dataList tr").each(function() {
				$("th:eq(1)", this).remove();
				$("th:last", this).remove();
				$("td:eq(1)", this).remove();
				$("td:last", this).remove();
			});
		});
	});
</script>